package cn.dliyy.warehouse.controller;

import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import cn.dliyy.warehouse.service.CompanyService;

@Controller
public class CompanyController {
	protected final transient Log log = LogFactory.getLog(StudentController.class);
	@Autowired
	private CompanyService companyService;

	public CompanyController() {
	}

	@RequestMapping(value = "/login/{user}", method = RequestMethod.GET)
	public ModelAndView myMethod(HttpServletRequest request, HttpServletResponse response, @PathVariable("user")
	String user, ModelMap modelMap) throws Exception {
		modelMap.put("loginUser", user);
		return new ModelAndView("/hello", modelMap);
	}

	@RequestMapping(value = "/welcome", method = RequestMethod.GET)
	public String registPost() {
		return "/welcome";
	}

	@RequestMapping(value = "/company")
	public String load(ModelMap modelMap) {
		List<Object> list = companyService.getCompanyList();
		modelMap.put("list", list);
		return "/base/company";

	}
}